<template>
  <div class="service-list">
    <div
      @click="handleClick(index)"
      :key="item.id"
      v-for="(item, index) in serviceList"
      class="service-list-item"
    >
      <div class="left">
        <van-icon size="6vw" class="icon" :name="item.icon" />
        <span>{{ item.name }}</span>
      </div>
      <div class="right">
        <van-icon name="arrow" />
      </div>
    </div>
  </div>
</template>

<script lang="js">
import {defineComponent, reactive, ref} from 'vue'
import { useRouter } from 'vue-router'
export default defineComponent({
  props: {
    serviceList:{
      type:Array,
      default(){
        return []
      }
    }
  },
  components: {

  },
  setup() {
    const router = useRouter();

    const handleClick=(index)=>{
      let path;
      switch(index){
        case 0:path='/studentLeave';break;
        case 1:path='/studentLeave';break;
        case 2:path='/studentLeave';break;
        case 3:path='/studentLeave';break;
        case 4:path='/studentLeave';break;
        case 5:path='/studentLeave';break;
      }
      router.push(path)
    }
    return {
      handleClick
    }

  }
})
</script>

<style scoped lang="less">
.service-list {
  padding: 6vw;
  .service-list-item {
    display: flex;
    justify-content: space-between;
    padding: 2vh 0;
    border-bottom: 1px solid #f0f0f0;
    .left {
      display: flex;
      align-items: center;
      .icon {
        margin-right: 4vw;
      }
    }
  }
}
</style>
